package com.tms.springboot.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.tms.springboot.base.pojo.PdTruck;
import com.tms.springboot.mapper.PdTruckMapper;
import com.tms.springboot.search.PdTruckSearch;
import com.tms.springboot.service.PdTruckService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.tms.springboot.view.PdTruckBasicsView;
import com.tms.springboot.view.PdTruckView;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 车辆信息表 服务实现类
 * </p>
 *
 * @author cjj
 * @since 2023-06-14
 */
@Service
public class PdTruckServiceImpl extends ServiceImpl<PdTruckMapper, PdTruck> implements PdTruckService {

    @Autowired
    private PdTruckMapper pdTruckerMapper;

    @Override
    public PageInfo<PdTruckView> pdTruckPage(PdTruckSearch pdTruckSearch) throws Exception {
        PageHelper.startPage(pdTruckSearch.getCurrentpage(),pdTruckSearch.getPagesize());
        List<PdTruckView> pdTruckViews = this.pdTruckerMapper.pdTruckPage(pdTruckSearch);
        PageInfo pageInfo = new PageInfo(pdTruckViews);
        return pageInfo;
    }

    @Override
    public List<PdTruckBasicsView> vehicledetailsService(PdTruck pdTruck) throws Exception {
        return this.pdTruckerMapper.vehicledetails(pdTruck);
    }

    @Override
    public boolean updateTruckService(PdTruck pdTruck) throws Exception {
        return this.pdTruckerMapper.updateTruck(pdTruck);
    }
}
